////////////////////////////////////////////////////////////////////////////////
// Filename: Entity.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _ENTITY_H_
#define _ENTITY_H_

//////////////
// INCLUDES //
//////////////
#include <windows.h>
#include <xnamath.h>
#include "Model3DInstance.h"
#include "PhysicEntityInstance.h"

#include <vector>

class Model3D;
class PhysicShape;
class TiXmlElement;
class Game;
class ShadowMap;

class Entity
{
public:
	Entity();
	Entity(const Entity&);
	~Entity();
	Entity operator=(Entity const&);

	virtual bool Initialize(Model3D *pModel, PhysicShape *pPhysicShape, bool pIsStatic, XMFLOAT3 pPosition, XMFLOAT4 pOrientation);
	virtual void InitializeByXml(TiXmlElement* entityElement);
	virtual void Uninit();
	virtual void Update(int pElapsedTime);
	virtual void PreRender();
	virtual void Render();
	//virtual void ShadowRender(ShadowMap* pShadowMap);
	virtual void GetBoundingBox(BoundingBox &pBoundingBox);
	virtual void NoRender();

	virtual void ApplyTransformToMesh(int meshIndex, const XMFLOAT4X4 &pTransform);

	virtual void SetPosture(std::string pPostureName);
	virtual void SetNextPosture(std::string pPostureName);
	virtual void SetPostureAmount(float pAmount);

	virtual bool IsStatic();

	void Entity::ApplyForce(XMFLOAT3 pForce, XMFLOAT3 pPosition);
protected:
	void EventStartRendering();
	void EventStopRendering();

	Game* mGame;
	std::vector<Model3DInstance*> mModel3DInstances;
	PhysicEntityInstance* mPhysicEntityInstance;
	bool mIsStatic;
	XMFLOAT3 mPosition;
	XMFLOAT4 mRotation;
	float mRenderDistanceMin;
	float mRenderDistanceMax;
	bool mIsRendering;
};
#endif